<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
        <title>学生成绩查询</title>
       <link rel="stylesheet" href="../../../dist/style/example.css"/>
       <link rel="stylesheet" href="../../../dist/dist/style/weui.css"/>
    </head>
    <body>
    <div class="container" id="container">
<div class="hd" id="xueshengchengji">
    <h1 class="page_title">学生成绩</h1>
</div>
<div class="bd">
    <div class="weui_search_bar" id="search_bar">
        <form class="weui_search_outer">
            <div class="weui_search_inner">
                <i class="weui_icon_search"></i>
                <input type="search" class="weui_search_input" id="search_input" placeholder="搜索" required/>
                <a href="javascript:" class="weui_icon_clear" id="search_clear"></a>
            </div>
            <label for="search_input" class="weui_search_text" id="search_text">
                <i class="weui_icon_search"></i>
                <span>搜索</span>
            </label>
        </form>
        <a href="javascript:" class="weui_search_cancel" id="search_cancel">取消</a>
    </div>
    <div class="weui_cells weui_cells_access search_show" id="search_show"> 	
    </div>


</div>
</div>
    </body>
    
	<script src="../../../dist/js/zepto.min.js"></script>
    <script>
    $(function(){
    	    $("#search_show").show();
            $('#container').on('focus', '#search_input', function () {
                var $weuiSearchBar = $('#search_bar');
                $weuiSearchBar.addClass('weui_search_focusing');
            }).on('blur', '#search_input', function () {
                var $weuiSearchBar = $('#search_bar');
                $weuiSearchBar.removeClass('weui_search_focusing');
                if ($(this).val()) {
                    $('#search_text').hide();
                } else {
                    $('#search_text').show();
                }
            }).on('input', '#search_input', function () {
                var $searchShow = $("#search_show");
                if ($(this).val()) {
                	GetNames={
							url:"GetStudentNameServlet",
							type:"POST",
							data:{
								studentname:$(this).val()
							},
							success:function(data){
								var k = 1;
								$("#search_show>.weui_cell").remove();
								for(var i=0;i<data.value.length;i++)
								{
									cell_p ="#cell_"+k.toString()+">a";
									cell ="#weui_cell_"+k.toString();
									k = k+1;
									//$(cell_p).attr("href","studentexamlistforquery.jsp?id="+data.value[i].id);
									//$(cell_p).html(data.value[i].chname);
									if(data.type)
									{
										if(data.value[i].id=="001")
										$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=findTuibuqianshi.jsp>"+data.value[i].item+"</a></div></div>");
										if(data.value[i].id=="002")
										$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=findJinbuqianshi.jsp>"+data.value[i].item+"</a></div></div>")
										if(data.value[i].id=="003")
										$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=findqian25.jsp>"+data.value[i].item+"</a></div></div>")
										if(data.value[i].id=="004")
										$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=finddanketuibu.jsp>"+data.value[i].item+"</a></div></div>")	
										if(data.value[i].id=="005")
										$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=findqian20.jsp>"+data.value[i].item+"</a></div></div>")	
									}
									else
									{
										$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=scoreLine.html?studentid="+data.value[i].id+">"+data.value[i].chname+"</a></div></div>")
										//$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=studentexamlistforquery.jsp?id="+data.value[i].id+">"+data.value[i].chname+"</a></div></div>")
									}	
								}
								//$("#cell_1>p").html(data.value[0].chname);
								//$("#cell_2>p").html(data.value[1].chname);
								//$("#cell_3>p").html(data.value[2].chname);
								//$("#cell_4>p").html(data.value[3].chname);
								//$("#cell_5>p").html(data.value[4].chname);
							},
							dataType:"json",
							error:function(data){
							},
						//	dateType:"",//服务端预期的数据返回类型...
							timeout:"30000",//请求超时的时间
							error:function(){//请求失败时的一个回调函数..
								//可以给用户号的提示...
							}
						};
					$.ajax(GetNames);
                } else {
                    $("#search_show>.weui_cell").remove();
                }
            }).on('touchend', '#search_cancel', function () {
                $("#search_show>.weui_cell").remove();
                $('#search_input').val('');
            }).on('touchend', '#search_clear', function () {
                $("#search_show>.weui_cell").remove();
                $('#search_input').val('');
            }).on('touchend', '#xueshengchengji', function () {
            	$('#search_input').val('成绩');
            	$('#search_input').focus();
            	GetNames={
						url:"GetStudentNameServlet",
						type:"POST",
						data:{
							studentname:"成绩"
						},
						success:function(data){
							var k = 1;
							$("#search_show>.weui_cell").remove();
							for(var i=0;i<data.value.length;i++)
							{
								cell_p ="#cell_"+k.toString()+">a";
								cell ="#weui_cell_"+k.toString();
								k = k+1;
								//$(cell_p).attr("href","studentexamlistforquery.jsp?id="+data.value[i].id);
								//$(cell_p).html(data.value[i].chname);
								if(data.type)
								{
									if(data.value[i].id=="001")
									$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=findTuibuqianshi.jsp>"+data.value[i].item+"</a></div></div>");
									if(data.value[i].id=="002")
									$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=findJinbuqianshi.jsp>"+data.value[i].item+"</a></div></div>")
									if(data.value[i].id=="003")
									$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=findqian25.jsp>"+data.value[i].item+"</a></div></div>")
									if(data.value[i].id=="004")
									$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=finddanketuibu.jsp>"+data.value[i].item+"</a></div></div>")	
									if(data.value[i].id=="005")
									$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=findqian20.jsp>"+data.value[i].item+"</a></div></div>")
								}
								else
								{
									$("#search_show").append("<div class='weui_cell' id='weui_cell_1'><div class='weui_cell_bd weui_cell_primary' id='cell_1'><a href=scoreLine.html?studentid="+data.value[i].id+">"+data.value[i].chname+"</a></div></div>")
								}	
							}
						},
						dataType:"json",
						error:function(data){
						},
					//	dateType:"",//服务端预期的数据返回类型...
						timeout:"30000",//请求超时的时间
						error:function(){//请求失败时的一个回调函数..
							//可以给用户号的提示...
						}
					};
				$.ajax(GetNames);
				
            });
            
    });
    </script>
</html>
